//
//  AFAppDotNetAPIClient.m
//  lianjiacaipu
//
//  Created by 黄振 on 16/3/4.
//  Copyright © 2016年 黄振. All rights reserved.
//

#import "AFAppDotNetAPIClient.h"

static NSString *const AFAPPDotNetAPIBaseURLString = BaseUrl;
static AFAppDotNetAPIClient *_sharedClicent = nil;
static dispatch_once_t onceToken;
@implementation AFAppDotNetAPIClient
+ (instancetype)sharedClicent {
    dispatch_once(&onceToken, ^{

        _sharedClicent = [[AFAppDotNetAPIClient alloc]initWithBaseURL:[NSURL URLWithString:AFAPPDotNetAPIBaseURLString]];
        _sharedClicent.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];

        [_sharedClicent.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
            switch (status) {
                case AFNetworkReachabilityStatusReachableViaWWAN: {

                }
                    break;
                case AFNetworkReachabilityStatusReachableViaWiFi:
                {

                }
                    break;
                case AFNetworkReachabilityStatusNotReachable:{
                    UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"网络错误,请检查网络" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                    [alertView show];

                }
                    break;
                    
                default:
                    break;
            }
        }];
        [_sharedClicent.reachabilityManager startMonitoring];
    
    });
    return _sharedClicent;
}



@end
